import request from '@/utils/request.js'

// import store from '@/store'
/**
 * @description: 获取文章分类
 * @data {*}
 * @return {Promise}
 */
export const cateListApi = () => {
  return request({
    method: 'get',
    url: '/my/cate/list'
  })
}

/**
 * @description: 添加文章分类
 * @data {*}
 * @return {Promise}
 */
export const addCateApi = (data) => {
  return request({
    method: 'post',
    url: '/my/cate/add',
    data
  })
}

/**
 * @description: 编辑文章分类
 * @data {*}
 * @return {Promise}
 */
export const updateCateApi = (data) => {
  return request({
    method: 'put',
    url: '/my/cate/info',
    data
  })
}

/**
 * @description: 根据id删除文章分类
 * @parmas {*} id
 * @return {Promise}
 */
export const delCateApi = (id) => {
  return request({
    method: 'delete',
    url: '/my/cate/del?id=' + id
    // params: {
    //   id: id
    // }
  })
}

/**
 * @description: 获取文章列表
 * @parmas {*} id
 * @return {Promise}
 */
export const getArticleApi = (params) => {
  return request({
    method: 'get',
    url: '/my/article/list',
    params
  })
}

/**
 * @description: 发布文章
 * @data {*} title,cate_id,content,state,cover_img
 * @return {Promise}
 */
export const pubArticleApi = (data) => {
  return request({
    method: 'post',
    url: '/my/article/add',
    data
  })
}
